package com.util.cdb.bean;

import org.springframework.util.StringUtils;

import java.util.HashMap;
import java.util.Map;

/**
 * @description: 工厂模式
 * @author: fengfazheng
 * @create: 2021-12-26 16:43
 **/
public class DataFactory {
    private static  Map<String,AbstractHandler> stringHandlerMap = new HashMap<>();
    public static AbstractHandler getInvokeStrategy(String dbType){
        return stringHandlerMap.get(dbType);
    }
    public static void register(String dbType,AbstractHandler handler){
        if(StringUtils.isEmpty(dbType)||null==handler){
            return;
        }
        stringHandlerMap.put(dbType,handler);
    }
}
